package cn.edu.ctbu.labtest.service;

import cn.edu.ctbu.labtest.dao.TeacherRepository;
import cn.edu.ctbu.labtest.domain.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface TeacherService {

    /**
     * 读取所有的学生写数据
     * @return
     */
    List<Teacher> findAll();

    /**
     * 只支持分页的查询
     * @param pageable
     * @return
     */
    Page<Teacher> findAll(Pageable pageable);

    /*
    分页，带过滤的查询
     */
    Page<Teacher> findAll( Example<Teacher> teacher,Pageable pageable);

    public List<Teacher> findByNameAndPassword(String name,String password);

    /*插入学生*/
    Teacher insert(Teacher teacher);

    /*更新学生*/
    Teacher update(Teacher teacher);

    /*通过Id获取学生*/
    Teacher getById(Integer id);

    /*通过姓名查询学生*/
    List<Teacher> findByName(String name);

    /**
     * 删除学生
     */
    void delete(Teacher teacher);

    void delete(Integer id);
}

